import os

# 指定文件夹路径
folder_path = 'your_folder_path'

# 遍历文件夹
for root, dirs, files in os.walk(folder_path):
    for file in files:
        if file.endswith('.txt'):
            file_path = os.path.join(root, file)
            os.remove(file_path)
            print(f"已删除文件: {file_path}")